package edu.bw.controller;

import edu.bw.common.CommonResult;
import edu.bw.service.PermissionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * 权限管理控制器
 */
@RestController
@RequestMapping("/permission")
@CrossOrigin
public class PermissionController {

    @Autowired
    private PermissionService permissionService;

    /**
     * 查询所有权限
     * 对应 SelectAllPermission
     */
    @GetMapping("/selectAllPermission")
    public CommonResult selectAllPermission() {
        List<Map<String, Object>> list = permissionService.selectAllPermission();
        return CommonResult.ok().put("list", list);
    }
}